UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N7KJL9U6AoAEI3R7Z1g3nkUyiw3G/ZPUt56YjhKNTYs=' 
WHERE 
  key_id = '05b4ba2f6a08b53fe2f3a6975e051972286952d68c44030e282455eb91e1d35f' 
  AND (
    token = 'N7KJL9U6AoAEI3R7Z1g3nkUyiw3G/ZPUt56YjhKNTYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030