UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '17Ctv+Kvgv+Xueh4kNcvgkPDDdAztAQZRbsMtDMDcqw=' 
WHERE 
  key_id = '45d33cc433dda310584a4841721cfc271cd1ca4287253003335ec08a6cf4cd9b' 
  AND (
    token = '17Ctv+Kvgv+Xueh4kNcvgkPDDdAztAQZRbsMtDMDcqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033