UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PgGCTPjWi3ABMw6qK/iyJx2UhDMrsf7DzXXmWZJ4O5o=' 
WHERE 
  key_id = '9fa376e6a5e965012857ba60cd7f45c245018266823bd54733c013a24049bfb7' 
  AND (
    token = 'PgGCTPjWi3ABMw6qK/iyJx2UhDMrsf7DzXXmWZJ4O5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053