UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EPPwcmBQ5oVV0GsgBpKHUlEDwCcZF86aOmGhh7nweck=' 
WHERE 
  key_id = '2551577c00d9844742c5e14873f3f8566a80ce1193a902e8720a828ab40618dc' 
  AND (
    token = 'EPPwcmBQ5oVV0GsgBpKHUlEDwCcZF86aOmGhh7nweck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026