UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ejDQh7uCXgLNmdbsb5Kx8aAckCKUWAb75sgNd4gK+Xo=' 
WHERE 
  key_id = '7227fc07fa3d3063dacea139558678deba00d8431e723d402b8a49d180f8f840' 
  AND (
    token = 'ejDQh7uCXgLNmdbsb5Kx8aAckCKUWAb75sgNd4gK+Xo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022