UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vZzS8c68g5cNIUj9dV4fQQwFCGV3rxsDjPM6AfssIi4=' 
WHERE 
  key_id = '8ff7ffb29fcbac1fdfa2fa0e589a768899b34c58b83c7029219d3701fde9bf6b' 
  AND (
    token = 'vZzS8c68g5cNIUj9dV4fQQwFCGV3rxsDjPM6AfssIi4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019