UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UUD/yMImZJhYjzm9ckR6Xs4f4T3oWdE9CIdMrAi+NSA=' 
WHERE 
  key_id = '5ec0b047a805562653f431808d6ac934531179ffe6a1032576d70cd9d1a1ffef' 
  AND (
    token = 'UUD/yMImZJhYjzm9ckR6Xs4f4T3oWdE9CIdMrAi+NSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031