UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5qlX+mr+HZ1t/o3gBb57U44zWQZmo/rLDdOPErMvQbg=' 
WHERE 
  key_id = 'b7a30c0e08fcc8e3f95d348f0662e01021f0927036280c88a9709171deb3eced' 
  AND (
    token = '5qlX+mr+HZ1t/o3gBb57U44zWQZmo/rLDdOPErMvQbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032