UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A9x9q1fBCumm8e+ZDtcvItSZFurQWmxRQK1zt7blYfg=' 
WHERE 
  key_id = '749bf361c230e2f94e903aa79d7cc3f43fd04973a6eef25ca23da4896c6d9a25' 
  AND (
    token = 'A9x9q1fBCumm8e+ZDtcvItSZFurQWmxRQK1zt7blYfg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024