UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tek0HLcozsXEIOqFHSbMXq55rkUHYnlytQYQTaCstnQ=' 
WHERE 
  key_id = 'aa272c134f692b7f5f4ce5fc585a1e37bfddc5fc5b7338d099194e85634295b2' 
  AND (
    token = 'tek0HLcozsXEIOqFHSbMXq55rkUHYnlytQYQTaCstnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024