UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i1KlYng4V4xUZC9qLOcbrxpRh4Jv5scnqK6jP/ptygs=' 
WHERE 
  key_id = '5bf297172b9c19a76b1174274c643c92ba82f8a0ee1d3d0255555de75885d86a' 
  AND (
    token = 'i1KlYng4V4xUZC9qLOcbrxpRh4Jv5scnqK6jP/ptygs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032