UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ewnNTMwH6MBWPu0uF3dLfpJRc8xcAEAuGpIoso+EKzI=' 
WHERE 
  key_id = 'fa578a7c382a3189f4b3405ff90fccf4666795104768b8e667802322dc514a64' 
  AND (
    token = 'ewnNTMwH6MBWPu0uF3dLfpJRc8xcAEAuGpIoso+EKzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00116