UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wnan40ewrTb50/MAH11VyR1Dg7E3thuPejaXih5oafM=' 
WHERE 
  key_id = '02eaca1b7113c5d43678b7ce1245856e4d8671e1db43e0d349eeb8b841859b94' 
  AND (
    token = 'Wnan40ewrTb50/MAH11VyR1Dg7E3thuPejaXih5oafM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029