UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '40NPof3ys6rwNDDNxz32CJPuV7R8sp3CQHpzveTzjfY=' 
WHERE 
  key_id = '7fe4eea77bfc20b984a1b52ca85d5f09862f2bcc2ba6027a21ac6a914cc514fa' 
  AND (
    token = '40NPof3ys6rwNDDNxz32CJPuV7R8sp3CQHpzveTzjfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046