UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a7mxwshSdk7zwnZhEKTOME5rGGOhx9Mm3T+07bm5dHQ=' 
WHERE 
  key_id = 'c4b6d4c59b93d05c1d39bdbc231b99570b6c965e62e1ec6e0cc11fc8364a512a' 
  AND (
    token = 'a7mxwshSdk7zwnZhEKTOME5rGGOhx9Mm3T+07bm5dHQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046