UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XGqpGkvJzWyxa92B0+FzpbsTu8F2+Ts4u4nwY7JoXbs=' 
WHERE 
  key_id = '3b490afb851a159ad219a3485fc007bbb072a73e6c45f14d4a0a28d7a8c62b1c' 
  AND (
    token = 'XGqpGkvJzWyxa92B0+FzpbsTu8F2+Ts4u4nwY7JoXbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063