UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SIT6rcWRHNeUDURjT9rscsgCWUVIYVbbALxPiiw+djo=' 
WHERE 
  key_id = '2f121852b16cb3317fdda6bf8d5c0582fdff24233584bbd9c5c705e5d4db804f' 
  AND (
    token = 'SIT6rcWRHNeUDURjT9rscsgCWUVIYVbbALxPiiw+djo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029