UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LEjA+t65+wKbci2JomIQEqOsMvBSldO2olvYaTC/u88=' 
WHERE 
  key_id = '4c5f1bde374468f486aeef80812edbde84c4a77ed6492708bc1820556b82ac2d' 
  AND (
    token = 'LEjA+t65+wKbci2JomIQEqOsMvBSldO2olvYaTC/u88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028