UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BxQOflYB3RP80Xo4coQDP43go7eo6t75Tq3s9DR99u4=' 
WHERE 
  key_id = '1dd88012389b399035279de4dd1cc11f53310b64a068f8933d74f62f87c22ea5' 
  AND (
    token = 'BxQOflYB3RP80Xo4coQDP43go7eo6t75Tq3s9DR99u4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038