UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k0TMne6eWbO5y25LV0FyQSanX9+lWz+aPyYPE51qc2U=' 
WHERE 
  key_id = '5fcc42e07492fea5fb025877216df87f5c9398135418b4bddb1dd02c5e03df9f' 
  AND (
    token = 'k0TMne6eWbO5y25LV0FyQSanX9+lWz+aPyYPE51qc2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017