UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4s+Am+NS1H4pxpK8qsloYEblT2mj7fS9EcuVtLE17k8=' 
WHERE 
  key_id = '23563f3cafde61b404867a825bd4404221379d3f7c3abcae1e9ac245f9b89039' 
  AND (
    token = '4s+Am+NS1H4pxpK8qsloYEblT2mj7fS9EcuVtLE17k8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045