UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p96/3i+BL005DOE6Xv1tv72FP9bH6hW09UtdndofLng=' 
WHERE 
  key_id = '9923035a74f909271d06bf6cb726bfd3e76ca054c4a946fd89fb4565a9f5f0c5' 
  AND (
    token = 'p96/3i+BL005DOE6Xv1tv72FP9bH6hW09UtdndofLng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025