UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fKrF8jPqdF3o35AI8KVUXafClkwXstj8fC7ePEfe/nQ=' 
WHERE 
  key_id = '4cf1933bbeef0356b0c0001f4db73cfcdf218040f15a77e1004fa202a474c866' 
  AND (
    token = 'fKrF8jPqdF3o35AI8KVUXafClkwXstj8fC7ePEfe/nQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037