UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PajXEmokAE1E9hlzrwCA+IQVva9vVeMieXwtXjiGywI=' 
WHERE 
  key_id = '20f31cbc8f2718ca66ff7f3183dc5382d37696cc169cf5637e0319a9082c7d22' 
  AND (
    token = 'PajXEmokAE1E9hlzrwCA+IQVva9vVeMieXwtXjiGywI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023