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

Query time 0.00027