UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fq3BEqTN9flQzApSMb7WL5nxS+SIyxW0Xw27v4DAmHA=' 
WHERE 
  key_id = '65538a16a1b0d6daa0a76dc2885f4a15110b4f5a2fb5a44f6836bf5a90cadc37' 
  AND (
    token = 'fq3BEqTN9flQzApSMb7WL5nxS+SIyxW0Xw27v4DAmHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032