UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tMUeyAOaA+UasA1W6ZH13MRAkmsScdR5hZk4e08tAOc=' 
WHERE 
  key_id = 'd70881fdbc22523ac2b7c395b7aa299efbf46c6c573402c18b55eee08deb3347' 
  AND (
    token = 'tMUeyAOaA+UasA1W6ZH13MRAkmsScdR5hZk4e08tAOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028