UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hMMwec6jb69b1Bpn8jwS3e9k9rSDpsIpY/3P0PYPVN0=' 
WHERE 
  key_id = '7f0c48aeedcbd5dc62abf1fb6a5e991cd7e41d61d7c47e98b9d8a6028188aa99' 
  AND (
    token = 'hMMwec6jb69b1Bpn8jwS3e9k9rSDpsIpY/3P0PYPVN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040