UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hepz1uaPQ6nhjC7j7HU0fs3/lzEanXu/qTq7ZYzeCrw=' 
WHERE 
  key_id = '719229c7341b457a8edc054b00339290d2e1001ffeed727d82bfefa4af5dc0f2' 
  AND (
    token = 'hepz1uaPQ6nhjC7j7HU0fs3/lzEanXu/qTq7ZYzeCrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032