UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HjR5+yRpiikC3097EYW6/oKnDSmd7XvQUEc2uW6CgBw=' 
WHERE 
  key_id = '0f57e1e9701baa92da753c78d6bd32af931ff6d6de83401f59b7d4335eb71d40' 
  AND (
    token = 'HjR5+yRpiikC3097EYW6/oKnDSmd7XvQUEc2uW6CgBw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028