UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pxN5fdhHCRMDxdyZnJsHMA1DXIf+v6+kvqIoxA592W4=' 
WHERE 
  key_id = '9d9ddd9de17b17997932825515e3ae7206d462624418184fed5276d8ad9296c8' 
  AND (
    token = 'pxN5fdhHCRMDxdyZnJsHMA1DXIf+v6+kvqIoxA592W4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050